import Vue from 'vue'
const imManager = require("./pages/index/utils/im-manager");
// MobileIMSDK服务端的WebSocket服务地址（如服务端已开启SSL，此处请使用wss）
const IM_SERVER_URL = "ws://chat.zwsmcn.com:3000/websocket";

Vue.prototype.$IM_SERVER_URL = IM_SERVER_URL

import kpsImageCutter from "@/components/ksp-image-cutter/ksp-image-cutter.vue";
Vue.component('kpsImageCutter', kpsImageCutter)
	
// 再设置MobileIMSDK服务端的WebSocket服务地址
imManager.IM_SERVER_URL = IM_SERVER_URL;



import App from './App'
import './uni.promisify.adaptor'
import Api from 'static/js/api.js'
import './uni.promisify.adaptor'
import Util from 'static/js/util.js'
import Validate from 'static/js/validate.js'
import uView from "uview-ui";
import delSlideLeft from '@/components/ay-operate/del_slideLeft.vue'
Vue.component('delSlideLeft', delSlideLeft)
Vue.use(uView);

uni.$u.config.unit = 'px'
import hxNavbar from '@/components/hx-navbar/hx-navbar.vue';
Vue.component('hxNavbar', hxNavbar)


import wxpup from '@/components/wxpup.vue';
Vue.component('wxpup', wxpup)


import md5 from 'static/js/md5.js';

Vue.prototype.$md5 = md5

import {
	DB
} from './util/sqlite/sqlite.js'

Vue.prototype.DB = DB

Vue.config.productionTip = false
Vue.prototype.$api = Api
Vue.prototype.$util = Util


Vue.prototype.$globalData =uni.getStorageSync('globalData') ?? {} //Api.globalData//{}

// Test git
Vue.prototype.$validate = Validate
Vue.prototype.goBack = () => {
	uni.navigateBack()
}
Vue.prototype.toPage = (url) => {
	uni.navigateTo({
		url: url
	})
}
Vue.prototype.toTab = (url) => {
	uni.switchTab({
		url
	})
}

Vue.prototype.$formatDate = (data) => {
	console.log(data);
	let now = new Date(data);
	var year = now.getFullYear(); //取得4位数的年份
	var month =
		now.getMonth() + 1 < 10 ?
		"0" + (now.getMonth() + 1) :
		now.getMonth() + 1;
	var date = now.getDate() < 10 ? "0" + now.getDate() : now.getDate();
	var hour = now.getHours() < 10 ? "0" + now.getHours() : now.getHours();
	var minute =
		now.getMinutes() < 10 ? "0" + now.getMinutes() : now.getMinutes();
	var second =
		now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds();

	console.log(second);
	return year +
		"-" +
		month +
		"-" +
		date +
		" " +
		hour +
		":" +
		minute +
		":" +
		second;
}

App.mpType = 'app'

const app = new Vue({
	...App
})
app.$mount()